// ast
// //////////////////////////////////////////////////////////
var fileInfoCtx = new ModuleContext('FileInfo','文件信息');

var fileInfoUI = new ModuleUI(fileInfoCtx);

fileInfoUI.checkEditForm = function(){
	var vConf = {};
	//
 	vConf = [
	{"name":"id","format":"Integer","tip":" 格式错误!"}
	, {"name":"fileSize","format":"Integer","tip":"文件大小 格式错误!"}
	, {"name":"linkId","format":"Integer","tip":"链接原始文件的id 格式错误!"}
	, {"name":"refcount","format":"Integer","tip":"引用计数 格式错误!"}
	];
	var v = new Validator(fileInfoCtx.EDIT_FORM_ID, vConf, true);
	var ok = v.validate();
	if(!ok){
		return false;
	}
	return true;
}

fileInfoUI.setViewItem = function(dataObj, viewObj){
	viewObj.setAttribute('class','row');
	viewObj.setAttribute('id', 'XXXListItem_' + dataObj.id);
	var children = DomUtil.getChildren(viewObj);
	children[0].firstChild.value = dataObj['id'];
	children[1].innerHTML = Widget.getView(dataObj['id'], 'hidden');
	//children[2].innerHTML = Widget.getView(dataObj['filePath'], 'file');
	UploadFileUtil.viewFile(children[2], dataObj['filePath']);
	children[3].innerHTML = Widget.getView(dataObj['fileName'], 'text');
	children[4].innerHTML = Widget.getView(dataObj['extName'], 'text');
	children[5].innerHTML = Widget.getView(dataObj['fileSize'], 'text');
	children[6].innerHTML = Widget.getView(dataObj['contentType'], 'text');
	children[7].innerHTML = Widget.getView(dataObj['hashCode'], 'text');
	children[8].innerHTML = Widget.getView(dataObj['fieldName'], 'text');
	children[9].innerHTML = Widget.getView(dataObj['oriFileName'], 'text');
	children[10].innerHTML = Widget.getView(dataObj['linkId'], 'text');
	children[11].innerHTML = Widget.getView(dataObj['refcount'], 'text');
	children[12].innerHTML = Widget.getView(dataObj['created'], 'date');
	children[13].innerHTML = Widget.getView(dataObj['modified'], 'date');
	children[14].firstChild.onclick = function(){fileInfoUI.editXXX(dataObj.id);};
	children[15].firstChild.onclick = function(){fileInfoUI.deleteXXX(dataObj.id);};
}


EventUtil.addEvent(window, 'load', function(){

		
});

//////////////////////////////////////////////////////////